home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Developers / XAMPP 1.5.4 / Windows installer / xampp-win32-1.5.4-installer.exe / xampp / install / portcheck.php < prev    next >
Encoding:
PHP Script  |  2005-12-04  |  840 b   |  33 lines

  1. <?php
  2.     $host = "127.0.0.1";
  3.     $timeout = 1;
  4.     $i = 1;
  5.  
  6.     $curdir = getcwd();
  7.     list($partition, $nonpartition) = split (':', $curdir);
  8.     list($partwampp, $directorwampp) = spliti ('\\\install', $curdir);
  9.     $portchecklog = $partwampp."\install\\portcheck.ini";
  10.  
  11.     $port = ereg_replace('-', '', $argv[1]);
  12.     $werte = substr_count($port, ',');
  13.     $ports = explode(',', $port);
  14.     $anzahl = count($ports);
  15.     $datei = fopen($portchecklog, 'w+');
  16.     fputs($datei, "[Ports]\r\n");
  17.     while ($i <= $anzahl) {
  18.         $a = $i - 1;
  19.  
  20.         settype($ports[$a], "integer");
  21.         if (($handle = @fsockopen($host, $ports[$a], $errno, $errstr, $timeout)) == false) {
  22.             $print = "Port".$ports[$a]."=FREE\r\n";
  23.         } else {
  24.             $print = "Port".$ports[$a]."=BLOCKED\r\n";
  25.         }
  26.         fputs($datei, $print);
  27.         @fclose($handle);
  28.         $i++;
  29.     }
  30.     fclose($datei);
  31.     exit;
  32. ?>
  33.